/**
 * @author 陈泰来
 * @version V1.0
 * @Project echo-java-base
 * @Title equals 和 == 的比较
 * @Description *
 * @Package base.equalsOrNot
 * @date 2021/3/26 3:04 下午
 * @Copyright:学如逆水行舟，不进则退 .
 */
package base.equalsOrNot;

public class EqualsOrNot {

    private static final String one = "1";

    public static void main(String[] args) {

        String s1 = "1";
        String s2 = "1";

        System.out.println("对象地址是否相同:" + (s1 == s2));
        System.out.println("对象引用地址指向的值是否相同:" + (s1.equals(s2)));
        System.out.println("常量1和s1或s2引用指向的值是否相同:" + (one.equals(s1)) + " || " + (one.equals(s2)));
        System.out.println("常量1和s1或s2的引用是否相同:" + (one == s1) + " || " + (one == s2));

        System.out.println(s1.hashCode());
    }
}
